package cn.swust.HuXinMeng.sound;

public class FilterSequence extends SoundFilter {

    private SoundFilter[] filters;

    public FilterSequence(SoundFilter[] filters) {
        this.filters = filters;
    }

    public int getRemainingSize() {
        int max = 0;
        for (int i=0; i<filters.length; i++) {
            max = Math.max(max, filters[i].getRemainingSize());
        }
        return max;
    }

    public void reset() {
        for (int i=0; i<filters.length; i++) {
            filters[i].reset();
        }
    }

    public void filter(byte[] samples, int offset, int length) {
        for (int i=0; i<filters.length; i++) {
            filters[i].filter(samples, offset, length);
        }
    }
}
